package kosta.model.memo;

import java.util.List;

import javax.annotation.Resource;

import kosta.model.member.MemberVO;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class MemoDaoImpl implements MemoDao {
	@Resource(name="sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public MemberVO idCheck(String id) throws Exception{
		return sqlSessionTemplate.selectOne("member.idCheck", id);
	}

	@Override
	public void sendMemo(MemoVO memoVO) throws Exception {
		sqlSessionTemplate.insert("memo.sendMemo", memoVO);
	}

	@Override
	public List<MemoVO> getMemoList(String id) throws Exception {
		System.out.println(id + " getMemoList Dao");
		return sqlSessionTemplate.selectList("memo.getMemoList", id);
	}

	@Override
	public void showMemoCheck(int no) throws Exception {
		sqlSessionTemplate.update("memo.showMemoCheck", no);
	}

	@Override
	public void outMemo(String no) throws Exception {
		sqlSessionTemplate.delete("memo.deleteMemo", Integer.parseInt(no));
	}

	@Override
	public List<MemoVO> sendMemoList(String id) throws Exception {
		return sqlSessionTemplate.selectList("memo.sendMemoList", id);
	}
}
